#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <net/route.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <net/if.h>
#include "cgic.h"

int cgiMain()
{
    FILE *fhtm = NULL;
    char *request_method = NULL;
    char *user_input = NULL;

    printf("Content-type:text/html;charset=utf-8\n\n");
    request_method = getenv("REQUEST_METHOD");
    if (strcmp(request_method, "GET") == 0)
    {
        user_input = getenv("QUERY_STRING");
        if (strcmp(user_input, "getdevinfo") == 0)
        {
            //向HTML传递参数
            fprintf(cgiOut, "FirmwareVersion=%s/", "固件版本 v1.00");
            fprintf(cgiOut, "readend");
        }
    }

    return 0;
}